<?php

namespace App\Http\Controllers\Api\V1\Resources;

use App\Models\BuyerNotice;
use Illuminate\Http\Resources\Json\JsonResource;

class GoldWasteResource extends JsonResource
{
    public function toArray($request): array
    {
    	$resource = $this->resource;

        return [
        	'id' => $resource->id,
	        'user_id' => $resource->user_id,
	        'gold_seed_id' => $resource->gold_seed_id,
	        'gold_product_id' => $resource->gold_product_id,
	        'round' => $resource->round,

            'product_cover' => img_path($resource->product_cover),
            'product_title' => $resource->product_title,

	        'resell_price' => $resource->resell_price,
	        'record_price' => $resource->record_price,
	        'record_beans' => $resource->record_beans,
	        'record_prize' => $resource->record_prize,

	        'is_paid' => $resource->isPaid(),
	        'is_closed' => $resource->isClosed(),
	        'has_applied_to_resell' => $resource->hasAppliedToResell(),
	        'has_applied_to_split' => $resource->hasAppliedToSplit(),
	        'has_applied_to_take' => $resource->hasAppliedToTake(),
	        'is_settled' => $resource->isSettled(),
	        'is_finished' => $resource->isFinished(),

	        'to_resell_applied_at' => (string)$resource->to_resell_applied_at,
	        'to_split_applied_at' => (string)$resource->to_split_applied_at,
	        'to_take_applied_at' => (string)$resource->to_take_applied_at,
	        'created_at' => (string)$resource->created_at,
        ];
    }
}
